// 对外暴露配置的路由
/**
 * 为了实现菜单权限，需要将菜单拆分：
 *  静态(常量)路由（所有人都能访问）
 *  动态(异步)路由（动态分配）
 */
// 全部路由
export const constantRoutes = [
    {
        path: '/login',
        name: 'Login', // 命名路由
        component: () => import('@/views/login/index.vue'),
        meta: {
            title: '登录',
            hidden: true, // 路由在菜单列表中是否隐藏
            icon: 'Promotion', // 菜单图标，支持elememt-plus全部图标
        }
    },
    {
        path: '/',
        name: 'Layout', // 命名路由
        component: () => import('@/layout/index.vue'),
        redirect: '/home',
        meta: {
            title: '',
            hidden: false,
            icon: '',
        },
        children: [
            {
                path: '/home',
                name: 'Home',
                component: () => import('@/views/home/index.vue'),
                meta: {
                    title: '首页',
                    hidden: false,
                    icon: 'HomeFilled'
                }
            }
        ]
    },
    {
        path: '/screen',
        name: 'Screen',
        component: () => import('@/views/screen/index.vue'),
        meta: {
            title: '数据大屏',
            hidden: false,
            icon: 'DataAnalysis'
        }
    },
    {
        path: '/404',
        name: '404', // 命名路由
        component: () => import('@/views/404/index.vue'),
        meta: {
            title: '404',
            hidden: true,
            icon: 'DocumentDelete'
        }
    },
    {
        path: '/acl',
        name: 'Acl',
        component: () => import('@/layout/index.vue'),
        meta: {
            title: '权限管理',
            hidden: false,
            icon: 'Lock'
        },
        redirect: '/acl/user',
        children: [
            {
                path: '/acl/user',
                name: 'User',
                component: () => import('@/views/acl/user/inedx.vue'),
                meta: {
                    title: '用户管理',
                    hidden: false,
                    icon: 'User'
                }
            },
            {
                path: '/acl/role',
                name: 'Role',
                component: () => import('@/views/acl/role/index.vue'),
                meta: {
                    title: '角色管理',
                    hidden: false,
                    icon: 'UserFilled'
                }
            },
            {
                path: '/acl/permisison',
                name: 'Permission',
                component: () => import('@/views/acl/permission/index.vue'),
                meta: {
                    title: '菜单管理',
                    hidden: false,
                    icon: 'Monitor'
                }
            },
        ]
    },
    {
        path: '/product',
        name: 'Product',
        component: () => import('@/layout/index.vue'),
        meta: {
            title: '商品管理',
            hidden: false,
            icon: 'Goods'
        },
        redirect: '/product/trademark',
        children: [
            {
                path: '/product/trademark',
                name: 'Trademark',
                component: () => import('@/views/product/trademark/index.vue'),
                meta: {
                    title: '品牌管理',
                    hidden: false,
                    icon: 'ShoppingCartFull'
                }
            },
            {
                path: '/product/attr',
                name: 'Attr',
                component: () => import('@/views/product/attr/index.vue'),
                meta: {
                    title: '属性管理',
                    hidden: false,
                    icon: 'ChromeFilled'
                }
            },
            {
                path: '/product/spu',
                name: 'Spu',
                component: () => import('@/views/product/spu/index.vue'),
                meta: {
                    title: 'spu管理',
                    hidden: false,
                    icon: 'Calendar'
                }
            },
            {
                path: '/product/sku',
                name: 'Sku',
                component: () => import('@/views/product/sku/index.vue'),
                meta: {
                    title: 'sku管理',
                    hidden: false,
                    icon: 'Orange'
                }
            },
        ]
    },
    {
        // 捕获所有不匹配其他路由的路径
        path: '/:pathMatch(.*)*',
        name: 'Any', // 命名路由
        redirect: '/404',
        meta: {
            title: '任意路由',
            hidden: true,
            icon: 'DataLine'
        }
    }
]

// 常量路由
// export const constantRoutes = [
//     {
//         path: '/login',
//         name: 'Login', // 命名路由
//         component: () => import('@/views/login/index.vue'),
//         meta: {
//             title: '登录',
//             hidden: true, // 路由在菜单列表中是否隐藏
//             icon: 'Promotion', // 菜单图标，支持elememt-plus全部图标
//         }
//     },
//     {
//         path: '/',
//         name: 'Layout', // 命名路由
//         component: () => import('@/layout/index.vue'),
//         redirect: '/home',
//         meta: {
//             title: '',
//             hidden: false,
//             icon: '',
//         },
//         children: [
//             {
//                 path: '/home',
//                 name: 'Home',
//                 component: () => import('@/views/home/index.vue'),
//                 meta: {
//                     title: '首页',
//                     hidden: false,
//                     icon: 'HomeFilled'
//                 }
//             }
//         ]
//     },
//     {
//         path: '/screen',
//         name: 'Screen',
//         component: () => import('@/views/screen/index.vue'),
//         meta: {
//             title: '数据大屏',
//             hidden: false,
//             icon: 'DataAnalysis'
//         }
//     },
//     {
//         path: '/404',
//         name: '404', // 命名路由
//         component: () => import('@/views/404/index.vue'),
//         meta: {
//             title: '404',
//             hidden: true,
//             icon: 'DocumentDelete'
//         }
//     },
// ]

// 动态(异步)路由
export const asyncRoutes = [
    {
        path: '/acl',
        name: 'Acl',
        component: () => import('@/layout/index.vue'),
        meta: {
            title: '权限管理',
            hidden: false,
            icon: 'Lock'
        },
        redirect: '/acl/user',
        children: [
            {
                path: '/acl/user',
                name: 'User',
                component: () => import('@/views/acl/user/inedx.vue'),
                meta: {
                    title: '用户管理',
                    hidden: false,
                    icon: 'User'
                }
            },
            {
                path: '/acl/role',
                name: 'Role',
                component: () => import('@/views/acl/role/index.vue'),
                meta: {
                    title: '角色管理',
                    hidden: false,
                    icon: 'UserFilled'
                }
            },
            {
                path: '/acl/permisison',
                name: 'Permission',
                component: () => import('@/views/acl/permission/index.vue'),
                meta: {
                    title: '菜单管理',
                    hidden: false,
                    icon: 'Monitor'
                }
            },
        ]
    },
    {
        path: '/product',
        name: 'Product',
        component: () => import('@/layout/index.vue'),
        meta: {
            title: '商品管理',
            hidden: false,
            icon: 'Goods'
        },
        redirect: '/product/trademark',
        children: [
            {
                path: '/product/trademark',
                name: 'Trademark',
                component: () => import('@/views/product/trademark/index.vue'),
                meta: {
                    title: '品牌管理',
                    hidden: false,
                    icon: 'ShoppingCartFull'
                }
            },
            {
                path: '/product/attr',
                name: 'Attr',
                component: () => import('@/views/product/attr/index.vue'),
                meta: {
                    title: '属性管理',
                    hidden: false,
                    icon: 'ChromeFilled'
                }
            },
            {
                path: '/product/spu',
                name: 'Spu',
                component: () => import('@/views/product/spu/index.vue'),
                meta: {
                    title: 'spu管理',
                    hidden: false,
                    icon: 'Calendar'
                }
            },
            {
                path: '/product/sku',
                name: 'Sku',
                component: () => import('@/views/product/sku/index.vue'),
                meta: {
                    title: 'sku管理',
                    hidden: false,
                    icon: 'Orange'
                }
            },
        ]
    },
]

// 任意路由
export const anyRoute = [
    {
        // 捕获所有不匹配其他路由的路径
        path: '/:pathMatch(.*)*',
        name: 'Any', // 命名路由
        redirect: '/404',
        meta: {
            title: '任意路由',
            hidden: true,
            icon: 'DataLine'
        }
    }
]